package pta;

import java.util.*;


class PersonOverride{
	private String name;
	private int age;
	private boolean gender;
	public PersonOverride(){
		this("default",1,true);
		
	}
	public PersonOverride(String name,int age,boolean gender){
		this.name=name;
		this.age=age;
		this.gender=gender;
	}
	
	

	@Override
	public String toString() {
		return name+"-"+age+"-"+gender;
	

	}

	//@Override
	/*public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + (gender ? 1231 : 1237);
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}*/

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonOverride other = (PersonOverride) obj;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	
	
}

	
	

	
	


public class main2 {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in );
		String m=s.nextLine();
		String n=s.nextLine();
		int n1=Integer.parseInt(m);
		int n2=Integer.parseInt(n);
		
		int k=0;
		
		PersonOverride[] persons1=new PersonOverride[n1];
		PersonOverride[] persons2=new PersonOverride[n2];
		
		
		for(int i=0;i<n1;i++){
			persons1[i]=new PersonOverride();
			
		}
		
		String[] strDigits=new String[3];
		String[] sc=new String[n2];
		
		for(int i=0;i<n2;i++){
			
			sc[i]=s.nextLine();
			strDigits=sc[i].split(" ");
			int a=Integer.parseInt(strDigits[1]);
			boolean b=Boolean.valueOf(strDigits[2]);
			PersonOverride person=new PersonOverride(strDigits[0],a,b);
	    
			if(i==0)
				persons2[k++] = person;

			if(i>0){
				for(int j=0;j<k;j++){
					if(persons2[j].toString().equals(person.toString()))
						break;
					if(j==k-1){
						persons2[k++]=person;
					}
				}
				
			}
			
			
		}
		
		
		for(int i=0;i<n1;i++){
	    	System.out.println(persons1[i]);
	    }
		 for(int i=0;i<k;i++){
		    	System.out.println(persons2[i]);
		    }
		    System.out.println(k);
		    System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
			}

		
		
	}